package top.likeqc.leetcode.editor.cn;

/**
 * @see <a href="https://leetcode.cn/problems/number-of-times-binary-string-is-prefix-aligned">1375.
 *     二进制字符串前缀一致的次数</a>
 */
public class NumberOfTimesBinaryStringIsPrefixAligned {
    public static void main(String[] args) {
        Solution solution = new NumberOfTimesBinaryStringIsPrefixAligned().new Solution();
    }
    // leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int numTimesAllBlue(int[] flips) {
            int max = 0;
            int ans = 0;

            for (int i = 0; i < flips.length; i++) {
                max = Math.max(max, flips[i]);
                if (max == i + 1) {
                    ans++;
                }
            }
            return ans;
        }
    }
    // leetcode submit region end(Prohibit modification and deletion)

}
